package com.melesta.payment.tapjoy;

import android.content.Context;
import android.content.Intent;
import android.os.Handler;
import android.util.Log;
import com.melesta.payment.PaymentManager;
import com.melesta.payment.PaymentTransaction;
import com.melesta.payment.interfaces.IListener;
import com.melesta.payment.interfaces.IRequestBuilder;
import com.melesta.payment.interfaces.ISystem;
import com.tapjoy.TapjoyConnect;
import com.tapjoy.TapjoyEarnedPointsNotifier;
import com.tapjoy.TapjoyLog;
import com.tapjoy.TapjoyNotifier;

public class TapjoySystem
  implements ISystem
{
  static final String SYSTEM_NAME = "tapjoy";
  private String appid;
  private IListener defaultListener;
  private Handler handler;
  private String secret;

  public Object get(String paramString)
  {
    if (paramString.equals("appid"))
      return this.appid;
    if (paramString.equals("secret"))
      return this.secret;
    return null;
  }

  public IListener getDefaultListener()
  {
    return this.defaultListener;
  }

  public String getName()
  {
    return "tapjoy";
  }

  public void getPoints(final boolean paramBoolean)
  {
    TapjoyConnect.getTapjoyConnectInstance().getTapPoints(new TapjoyNotifier()
    {
      public void getUpdatePoints(String paramAnonymousString, int paramAnonymousInt)
      {
        Log.d("tapjoy", "currencyName: " + paramAnonymousString);
        Log.d("tapjoy", "pointTotal: " + paramAnonymousInt);
      }

      public void getUpdatePointsFailed(String paramAnonymousString)
      {
        TapjoyListenerRequest localTapjoyListenerRequest;
        if (!paramBoolean)
        {
          localTapjoyListenerRequest = (TapjoyListenerRequest)PaymentManager.getInstance().getRequest(new TapjoyListenerRequestFilter(null));
          if (localTapjoyListenerRequest != null);
        }
        else
        {
          return;
        }
        PaymentManager.getInstance().postResponse(new TapjoyErrorResponse().setName(localTapjoyListenerRequest.getName()).setListener(TapjoySystem.this.defaultListener).setError(paramAnonymousString).setErrorCode(1));
      }
    });
  }

  public IRequestBuilder getRequestBuilder()
  {
    return new TapjoyRequestBuilder(this);
  }

  public boolean onActivityResult(Context paramContext, int paramInt1, int paramInt2, Intent paramIntent)
  {
    return false;
  }

  public void onCreate(Context paramContext, Handler paramHandler)
  {
    this.handler = paramHandler;
    TapjoyLog.enableLogging(true);
    TapjoyConnect.requestTapjoyConnect(paramContext.getApplicationContext(), this.appid, this.secret);
    TapjoyConnect.getTapjoyConnectInstance().setEarnedPointsNotifier(new TapjoyEarnedPointsNotifier()
    {
      public void earnedTapPoints(int paramAnonymousInt)
      {
      }
    });
  }

  public void onDestroy(Context paramContext, Handler paramHandler)
  {
  }

  public void onPause(Context paramContext, Handler paramHandler)
  {
  }

  public void onResume(Context paramContext, Handler paramHandler)
  {
  }

  public void onStart(Context paramContext, Handler paramHandler)
  {
  }

  public void onStop(Context paramContext, Handler paramHandler)
  {
  }

  public void purchaseProcessed(PaymentTransaction paramPaymentTransaction)
  {
  }

  public TapjoySystem set(String paramString, Object paramObject)
  {
    if (paramString.equals("appid"))
      this.appid = paramObject.toString();
    while (!paramString.equals("secret"))
      return this;
    this.secret = paramObject.toString();
    return this;
  }

  public TapjoySystem setDefaultListener(IListener paramIListener)
  {
    this.defaultListener = paramIListener;
    return this;
  }

  public void showOffers()
  {
    TapjoyConnect.getTapjoyConnectInstance().showOffers();
    this.handler.post(new Runnable()
    {
      public void run()
      {
        TapjoySystem.this.getPoints(false);
      }
    });
  }
}

/* Location:           E:\android\Toy Defense 2_dex2jar.jar
 * Qualified Name:     com.melesta.payment.tapjoy.TapjoySystem
 * JD-Core Version:    0.6.2
 */